package org.mspring.platform.dao.query.convert.impl;

import org.mspring.platform.dao.query.convert.ConversionException;
import org.mspring.platform.dao.query.convert.Converter;

/**
 *
 * @author Gao Youbo
 * @since 2012-9-20
 */
public class BooleanConverter implements Converter {

    @Override
    public Object convert(Class<?> type, String value) throws ConversionException {
        if (org.apache.commons.lang3.StringUtils.isNotBlank(value)) {
            if ("1".equals(value) || "true".equalsIgnoreCase(value) || "on".equalsIgnoreCase(value) || "yes".equalsIgnoreCase(value)) {
                return true;
            } else {
                return false;
            }
        }
        return false;
    }

}
